import json
from datetime import datetime
import time
import asyncio


dict1 = {}

for i in range(0,5):
    time_in_mills = int(datetime.now().timestamp() * 1000)
    key = f'key_{time_in_mills}'
    dict1[key] = time_in_mills
    time.sleep(0.2)

print(f"-------dict1 : {dict1}")


def del_earliest(original:dict):
    min_value = min(original.values())
    keys_to_remove = [key for key, value in original.items() if value == min_value]
    for key in keys_to_remove:
        original.pop(key)
    print(f"-------min_value : {min_value}")


del_earliest(dict1)
print(f"-------dict1 : {dict1}")




dict2 = {}
for i in range(0, 15):
    dict2[i] = (i % 2) == 0

flag = all(dict2.values())
print(f"-------dict2 : {dict2}")
print(f"-------flag : {flag}")



cached_sleeve_ids:dict[int, asyncio.Queue] = dict()
queue = asyncio.Queue()
queue.put_nowait(3)
cached_sleeve_ids[2] = queue
print(f"-------cached_sleeve_ids : {cached_sleeve_ids}")



with open('config.json', 'r', encoding='utf-8') as file:
    content = file.read()

data_info = json.loads(content)
devices = data_info["qualitylocationList"]
map_data = [dict(deviceId=f"{item['qualitylocationId']}", stationId="", isSleeve=False) for item in devices]
print(f"{json.dumps(map_data)}")




